#!/usr/bin/node

const log = console.log,
      fs = require('fs');
      
if(process.argv.length!==3){
  log('Incorrect command line parameters');
  process.exit(1);
}
 
try{
  let w = fs.watch(__dirname, log);
  process.on('SIGINT',()=>{
    w.close();
    log('The program is about to end');
    log('Game over after 5 second...');

    setTimeout(()=>{
      process.exit(3);
    },5000);
  })

}catch(e){
  console.error(e.message);
  process.exit(2);
}

